import request from '@/utils/request';

export async function fetchImgcode() {
  var token = localStorage.getItem('token');
  return await request.post('/api/1.0/common/code/80/38', {
    token: token
  });
}

/**
 * 获取token
 * @returns {Promise<void>}
 */
export async function fetchHomeToken() {
  return await request.post('/home', {
    jobId: new Date(),
    hdp: 'company'
  });
}


export async function fetchToken(email, password, verifykey, hdp) {
  return await request.post('/api/1.0/manager/user/login', {
    account: email,
    passWord: password,
    securityCode: verifykey,
    hdp: hdp,
    token:localStorage.getItem('token')
  });
}

export async function isKey(code) {
  var token = localStorage.getItem('token');
  return await request.post('/code/check', {
    securityCode: code,
    token: token
  });
}

export async function getUserInfo() {
  return await request.post('/api/1.0/manager/user/info', {});
}

export let QR = async (token)=>{
  return request.post('/weixin/1.0/company/login/gogo',{
    token
  })
}